<?php
$usermailServer = "itservice@adinop.co.th";
$passmailServer = "adinop123*";
include ("class.phpmailer.php");
function script_sendmail($to_name, $to_email, $from_name, $email_user_send, $email_pass_send, $subject, $body_html, $body_text) {

    $mail = new PHPMailer();
    $mail->From = $email_user_send;
    $mail->FromName = $from_name;

    $mail->AddAddress($to_email, $to_name);
    $mail->Subject = $subject;
    $mail->Body = $body_html;
    $mail->AltBody = $body_text;
    $mail->IsHTML(true);
    $mail->CharSet = "utf-8"; //กำหนด charset ของภาษาในเมล์ให้ถูกต้อง เช่น tis-620 หรือ utf-8

    $mail->IsSMTP();
//$mail->Host = 'ssl://smtp.gmail.com';
//$mail->Port = 465;
    $mail->Host = 'mail.adinop.co.th';
    $mail->Port = 25;
//$mail->SMTPAuth   = true;
//$mail->SMTPDebug  = true;
    $mail->Username = $email_user_send;
    $mail->Password = $email_pass_send;

    $mail->Send();
    $mail->ClearAddresses();
}

### FUNCTION SEND MAIL #
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
//////////////////	ทดสอบส่งอีเมล์//////////////////////////////////////////		   
$to_email_it	="suchart@adinop.co.th";
$from_name_it	="noreply@adinop.co.th";
$email_user_send_it	="$usermailServer";
$email_pass_send_it	="$passmailServer";;
$subject_it	="[ มีผู้เขียนใบแจ้งซ่อม ]";
$body_html_it	="
<table width=\"550\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\">
  <tr>
    <td colspan=\"2\">
<p style=\"font-size:16px; color:#660099\">แจ้งซ่อมคอมพิวเตอร์ เรื่อง ............... เพิ่มเติม  <a href=\"http://webportal/systemit/\">&nbsp;webportal/systemit</a></p>
 </td>
  </tr>
    <tr>
    <td colspan=\"2\"><div>
      <p>Regards,       </p>
      <p>IT Service Team.</p>
      <p>http://webportal/systemit/</p>
    </div></td>
  </tr>
</table>
";
//$body_text ="";

script_sendmail($to_name,$to_email_it,$from_name_it,$email_user_send_it,$email_pass_send_it,$subject_it,$body_html_it,$body_text);
if(script_sendmail){
  echo "SEND MAIL COMPLETE";
}
?>
</body>
</html>
